package com.neuedu.elmserver.controller;

import com.neuedu.elmserver.service.ReviewService;
import com.neuedu.elmserver.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 评价表 前端控制器
 * </p>
 */
@RestController
@RequestMapping("/review")
@CrossOrigin(origins = "http://localhost:5173") // 允许的源
public class ReviewController {

    @Autowired
    private ReviewService reviewService;

    /**
     * 根据用户编号查询评价列表
     * @param userId
     * @return
     */
    @CrossOrigin(origins = "http://localhost:5173")
    @GetMapping("/listReviewsByUserId")
    public ResultVO listReviewsByUserId(@RequestParam Integer userId) {
        return reviewService.getReviewsByUserId(userId);
    }

}
